class A(object):
  def run(self):
    print("基础 run 方法")


class B(A):
  def run(self):
    print("衍生 run 方法 ")


# def print_str(str_a):
#   length = len(str_a)
#   n = length // 8 + ( 1 if length % 8 > 0 else 0)
#   left = 0
#   right = 8
#   for i in range(n):
#     if right > length:
#       print(str_a[left:length] + '0'*(right-length))
#     else:
#       print(str_a[left:right])
#     left += 8
#     right += 8
# count = int(input())
#
# list_str = []
# for i in range(count):
#   print_str(input())


while True:
  try:
    a = int(input())
    for i in range(a):
      s = input()
      while len(s) > 8:
        print(s[:8])
        s = s[8:]
      print(s.ljust(8, "0"))
  except:
    break
